<?php

namespace app\modules\setting\models\seller;

use sookie\db\ITRecordModel;
use yii\data\ArrayDataProvider;

/**
 * 记录 "set_seller_yhzx" 的模型类.
 *
 * @property string $selected_num 被选中次数.
 * @property string $wait_send_num 待发货数.
 * @property string $selling_num 带货中数量.
 */
class SetSellerYhzx extends \sookie\db\RecordModel implements ITRecordModel
{
    /**
     * {@inheritdoc}
     */
    public static function getRecordID()
    {
        return 'set_seller_yhzx';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [[["selected_num","wait_send_num","selling_num"],"safe"]];
    }

    /**
    * @param array $params
    * @return ArrayDataProvider
    * 搜索
    */
    public function search($params = []){

        $query = self::find();

        $this->load($params);

        $query->andFilterWhere(['like', 'selected_num', $this->selected_num]);
        $query->andFilterWhere(['like', 'wait_send_num', $this->wait_send_num]);
        $query->andFilterWhere(['like', 'selling_num', $this->selling_num]);
        
        return new ArrayDataProvider([
            'allModels' => $query->all(),
            'pagination' => [
                'pageSize' => 10,
            ],
            'sort' => [
                'attributes' => ["selected_num","wait_send_num","selling_num"],
            ],
        ]);
    }
}
